// 


def loopFile(){
   
   // https://stackoverflow.com/questions/15231810/pass-method-as-parameter-in-groovy  将方法作为参数传递给另外一个方法
   def dir = new File("D:\\data\\appdatas\\cat")
   dir.eachFile(groovy.io.FileType.FILES, this.&printFile)
   print this   
}

def printFile(file){
   println file.name
   println file.path
}

loopFile()